package com.marchsoft.campushelp.repository;

import com.marchsoft.campushelp.domain.CampusUserTable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;

/**
* @author 李诗莹
* @date 2020-03-13
*/
public interface CampusUserTableRepository extends JpaRepository<CampusUserTable, Long>, JpaSpecificationExecutor<CampusUserTable> {

    CampusUserTable findByPhone(String phone);

    @Modifying
    @Query(value = "update campus_user_table set login_password = ?2 where phone = ?1",nativeQuery = true)
    void updatePass(String username, String pass);
    @Modifying
    @Query(value = "update campus_user_table set phone = ?2 where id = ?1",nativeQuery = true)
    void updatePhone(Long id, String phone);
    @Modifying
    @Query(value = "update campus_user_table set nick_name = ?2 where id = ?1",nativeQuery = true)
    void updateNick(Long id, String phone);
}